class TeamController < ApplicationController
    def login
      @title = 'Login'
    end
    
    def verify
        submissions = Submission.new()

        team = Team.find(:first,:conditions => 
                          ["name = ? and password = ?", 
                           params[:team][:name], params[:team][:password]])
        if team
            session['team'] = team 
            if team.is_admin == true
                redirect_to :controller => "admin", :action => "submissions"
            else
                redirect_to :controller => "submit", :action => "submissions"
           end 
        else    
          flash['notice'] = "Bad team name or password!" 
          redirect_to :controller => "team", :action => "login" 
        end     
    end

    def logout
        reset_session
        #Redirect users to team#login
        redirect_to :controller => "team", :action => "login"
    end 
end
